//
// Created by NASA on 2024/7/12.
//

#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;
struct Man
{
    string name;
    int age;
};

bool cmp(Man a,Man b)
{
    return a.age<b.age;
}

int main()
{

    Man a = {"ZhangSan", 10};
    Man b = {"LiSi", 12};
    Man c = {"WangWu", 11};
    Man d = {"ZhaoLiu", 9};
    vector<Man> men{a, b, d, c};
    sort(men.begin(),men.end(),cmp);
    for (int i = 0; i < men.size(); ++i)
    {
        cout << men[i].name << ' ';
        cout << men[i].age << endl;
    }
//    cout<<men.at(10).age;
    return 0;
}